<!DOCTYPE html>
<html lang="en">
<head>

	<meta charset="utf-8">
    <title>商品管理|添加商品</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    
    <!-- Le styles -->
    <link href="/cssadmin/bootstrap.css" rel="stylesheet">
    <link href="/cssadmin/font-awesome.css" rel="stylesheet">
    <link href="/cssadmin/admin.css" rel="stylesheet">
    <script src="/jsadmin/jquery.min.js"></script>
    <!--编辑器-->
    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
	    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
   <script src="/bjq/tinymce.min.js"></script>
<script>tinymce.init({selector:'textarea',toolbar1: "undo redo | cut copy paste | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | styleselect formatselect fontselect fontsizeselect",
        toolbar2: " searchreplace | bullist numlist | outdent indent blockquote | link unlink anchor image media code | inserttime preview | forecolor backcolor",
        toolbar3: "table | hr removeformat | subscript superscript | charmap emoticons | print fullscreen | ltr rtl | spellchecker | visualchars visualblocks nonbreaking pagebreak restoredraft",
        menubar: false,
        toolbar_items_size: 'small',
        style_formats: [
            {title: 'Bold text', inline: 'b'},
            {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
            {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
            {title: 'Example 1', inline: 'span', classes: 'example1'},
            {title: 'Example 2', inline: 'span', classes: 'example2'},
            {title: 'Table styles'},
            {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
        ],
        templates: [
            {title: 'Test template 1', content: 'Test 1'},
            {title: 'Test template 2', content: 'Test 2'}
        ],plugins: [
            "advlist autolink autosave link image lists charmap print preview hr anchor pagebreak spellchecker",
            "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
            "table contextmenu directionality emoticons template textcolor paste fullpage textcolor"
        ],language:'zh_CN'});</script>
		<style>
			.right_content{
		
			position: absolute;
			top: 15%;
			right: 14%;
		}
		#content{
			position: relative;
			left: 100px;
			top: 85px;
		}
		#showpic{
		position: relative;
		left: 158px;
		top: -20px;
		}
		</style>
		
</head>    
<body>

<div class="container">
	<div class="row">
		<div class="span2">
			<div class="main-left-col">
				<h1><i class="icon-shopping-cart icon-large"></i> Admin</h1>
				<ul class="side-nav">
					<li>
						<a href="{{url('admins/index')}}"><i class="icon-home"></i> 管理中心</a>
					</li>
					<li class="dropdown active">
						<a class="dropdown-toggle" data-toggle="collapse" data-target="#website-dropdown" href="#"><i class="icon-sitemap"></i> 商品管理 <b class="caret"></b></a>
						<ul id="website-dropdown">
							<li><a href="{{url('admins/glist')}}">商品列表</a></li>
							<li><a href="{{url('admins/clist')}}">商品分类</a></li>
							<li class="active"><a href="{{url('admins/gadd')}}">添加商品</a></li>
							<li><a href="{{url('admins/cadd')}}">添加分类</a></li>
							<li><a href="{{url('admins/grealdel')}}">回收站</a></li>
						</ul>
					</li>
					<li class="dropdown">
						<a class="dropdown-toggle" data-toggle="collapse" data-target="#store-dropdown" href="#"><i class="icon-shopping-cart"></i> 订单管理 <b class="caret"></b></a>
						<ul id="store-dropdown" class="collapse">
							<li><a href="{{url('order/wf')}}">订单列表(未付款)</a></li>
							<li><a href="{{url('order/ys')}}">订单列表(已付款)</a></li>
							<li><a href="{{url('order/yf')}}">订单列表(已发货)</a></li>
							<li><a href="{{url('order/end')}}">订单列表(已完成)</a></li>
						</ul>
					</li>
					<li class="dropdown">
						<a class="dropdown-toggle" data-toggle="collapse" data-target="#reports-dropdown" href="#"><i class="icon-signal"></i> 会员管理 <b class="caret"></b></a>
						<ul id="reports-dropdown" class="collapse">
							<li><a href="report.html">会员列表</a></li>
						</ul>
					</li>
					<li class="dropdown">
						<a class="dropdown-toggle" data-toggle="collapse" data-target="#report-dropdown" href="#"><i class="icon-file"></i> 素材管理 <b class="caret"></b></a>
						<ul id="report-dropdown" class="collapse">
							<li><a href="{{url('img/list')}}">图片空间</a></li>
							<li><a href="{{url('img/up')}}">上传图片</a></li>
						</ul>
					</li>
					<li class="dropdown">
						<a class="dropdown-toggle" data-toggle="collapse" data-target="#settings-dropdown" href="#"><i class="icon-cogs"></i> 权限管理 <b class="caret"></b></a>
						<ul id="settings-dropdown" class="collapse">
							<li><a href="{{url('admins/reg')}}">添加管理员</a></li>
							<li><a href="{{url('admins/adminlist')}}">管理员列表</a></li>
							<li><a href="{{url('admins/roleadd')}}">添加角色</a></li>
							<li><a href="{{url('admins/rolelist')}}">角色列表</a></li>
						</ul>
					</li>
				</ul>
			</div> <!-- end main-left-col -->
		</div> <!-- end span2 -->
	
	<div class="span10">
		<div class="main-area dashboard">
			<?php echo $tishiinfo;?>
	</div>	
	<div class="row">
			<div class="span10">
				<a href="{{url('admins/glist')}}" class="btn btn-danger">仓库中的商品</a>
				<a href="{{url('admins/gadd')}}" class="btn btn-success">添加新商品</a>
				<a href="{{url('admins/cadd')}}" class="btn btn-primary">增加新分类</a>
				<a href="#" class="btn btn-default">回收站</a>
			</div>
		<div class="span3">
			<div class="page-header">
				<h2>添加新商品:</h2>
			</div>
			<div class="page-body">
				<form action="{{url('admins/gadd')}}" method="post" class="form-horizontal" enctype="multipart/form-data" id="form_id">
				<div class="control-group">
					<label class="control-label" for="goodsname">商品名称:</label>
				    <div class="controls">
				      	<input type="text" id="goodsname" placeholder="填入商品名称(必填)" name="goods_name">
				    </div>
				</div>
				<div class="control-group">
					<label class="control-label" for="goods_sn">商品货号:</label>
					<div class="controls">
						<input type="text" id="goods_sn" placeholder="不填则自动生成" name="goods_sn">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="goodskucun">商品库存:</label>
					<div class="controls">
						<input type="number" id="goodskucun" name="goods_number" placeholder="填入商品库存(必填)" >
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="catparent">商品分类:</label>
				    <div class="controls">
				      	<select id="catparent" name="cat_id">
							@foreach($catlist as $cat)
								<option class="disabled1" value="{{$cat['cat_id']}}">{{$cat['cat_name']}}</option>
								@foreach($cat['sbu'] as $caterzi)
									@if($cat['cat_id'] == $caterzi['parent_id'])
										<option value="{{$caterzi['cat_id']}}">|---{{$caterzi['cat_name']}}</option>
									@endif
								@endforeach
							@endforeach
						</select>
						<script>
							$(document).ready(function(){
								$('.disabled1').prop('disabled',true);
							});
						</script>
				    </div>
				</div>
				<div class="control-group">
					<label class="control-label" for="goodsnumber">本店售价:</label>
				    <div class="controls">
				      	<input type="number" id="goodsnumber" placeholder="(必填)"name="shop_price">
				    </div>
				</div>
				<div class="control-group">
					<label class="control-label" for="goodsnumber">市场售价:</label>
					<div class="controls">
						<input type="number" id="goodsnumber" placeholder="(必填)"name="market_price">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="goodpic">商品主图:</label>
				    <div class="controls">
				      	<input type="file" id="goodpic" placeholder="" name="goodpic">
				    </div>
				</div>
				<div class="control-group">
					<label class="control-label" for="goodsname">图片预览:</label>
				    
				    <img src="/img/T04.jpg" class="img-rounded" style="width:225px;" id="showpic">
				</div>
				<div class="control-group">
					<label class="control-label" for="goodsname">主图2:</label>
				    <div class="controls">
				      	<input type="text" id="goodsname" placeholder="填入图片URL" name="">
				    </div>
				</div>
				<div class="control-group">
					<label class="control-label" for="goodsname">主图3:</label>
				    <div class="controls">
				      	<input type="text" id="goodsname" placeholder="填入图片URL" name="">
				    </div>
				</div>
				<script>
					/**
					 * Ajax上传图片   获取到保存的地址存入hidden框中
					 */
					$(document).ready(function(){
						$('#goodpic').change(function(){
							var fom = document.getElementById('form_id');
							var fmdata = new FormData(fom);
							var xhr = new XMLHttpRequest();
							xhr.onreadystatechange = function(){
								if(this.readyState == 4){
									var rs = this.responseText;
									$('#showpic').attr('src',rs);
									$('#pic').val(rs);
								}
							}
							xhr.open('post','{{url('admins/img')}}',false);
							xhr.send(fmdata);
						});
					});
				</script>
				{!! csrf_field() !!}
				<input type="hidden" name="goodspic" id="pic">
				<div class="control-group">
					<label class="control-label" ></label>
				    <div class="controls">
				      	<button class="btn btn-success" type="submit">提交</button>
				      	&nbsp;
				      	<button class="btn btn-danger" type="reset">重置</button>
				    </div>
				</div>
			</form>
			</div>
		</div>
		<div class="span6" id="content">
			<h3>商品详情:</h3>
			<textarea name="content" class="right_content" form="form_id" style="width:100px;height:450px;"></textarea>
		</div>
	<div class="row">
		<div class="span10 footer">
			<p>&copy; Web2016</p>
		</div>
	</div>
</div>	
</div> <!-- end container -->

<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->

<script src="/jsadmin/bootstrap.js"></script>
</body>
</html>